package fr.afcepf.ticketing.dao;

import java.util.Collection;

import javax.annotation.PostConstruct;
import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import fr.afcepf.ticketing.domain.Type;

@Stateless
@Local
public class TypeDaoJpa extends GenericDaoJpa<Type,Long> implements TypeDao {
	
	@PersistenceContext 
	private EntityManager em;
	
	@PostConstruct
	public void initEntityManagerOfGenericDaoJpa(){
		super.setEntityManager(em);
	}
	
	
	@Override
	public Collection<Type> allTypes(long id) {
		return em.createQuery("select t from Type as t where t.catalog="+id).getResultList();
	}
	
	

}
